<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/',function () {
    return view('welcome');
});
Route::get('/hello',function () {
    echo 'hello';
});
Route::any('/test1',function () {
    echo '当前的是any';
});
Route::match(['get','post'],'/test2',function () {
    echo '当前的是match';
});

//必填参数测试
Route::any('/test3/{id}',function ($id) {
    echo '当前的id是'.$id;
});
//可填参数测试
Route::any('/test4/{id?}',function ($id='') {
    echo '当前的id是'.$id;
});
//通过？获取get参数
Route::any('/test5',function () {
    echo '当前的id是'.$_GET['id'];
});
//赋予路由别名
Route::any('/test6',function () {
    echo '当前的id是'.$_GET['id'];
})->name('test6min');
//路由群组
Route::group(['prefix'=>'admin'],function(){
    Route::get('test1',function () {
        echo 'nihao';
        //匹配“/admin/test1"URL
    });
    Route::get('test2',function () {
        //匹配“/admin/test2"URL
    });
});

//控制器路由方法
Route::get('/home/test/test1','TestController@test1');
//分目录管理
Route::get('/home/index/index','Home\IndexController@index');
Route::get('/admin/index/index','Admin\IndexController@index');
Route::get('/home/test/test2','TestController@test2');

//DB门面的增删改查
Route::group(['prefix' => 'home/test'],function(){
    Route::get('add','TestController@add');
    Route::get('del','TestController@del');
    Route::get('update','TestController@update');
    Route::get('select','TestController@select');
    Route::get('test3','TestController@test3');
});
//相关test
Route::get('home/test/test4','TestController@test4');
Route::get('home/test/test5','TestController@test5');
//csrf验证
Route::get('home/test/test6','TestController@test6');
Route::post('home/test/test7','TestController@test7') -> name('test7');
//模型的增删改查
Route::any('home/test/test8','TestController@test8') -> name('test8');
Route::get('home/test/test9','TestController@test9');
Route::get('home/test/test10','TestController@test10');
Route::get('home/test/test11','TestController@test11');
Route::get('home/test/test12','TestController@test12');
//自动验证（自己提交给自己）
Route::any('home/test/test13','TestController@test13');











//缓存操作
Route::get('home/test/test19','TestController@test19');
//辅助函数
Route::get('home/test/testArr','TestController@testArr');